/*
 * Copyright (c) 2010 Philip Foulkes <philip.foulkes@gmail.com>
 *
 * This file is free software and is made available under the 
 * terms of the GNU General Public License, version 2, or at your
 * option, any later version
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _MRP_PORT_H_
#define _MRP_PORT_H_

struct mrp_mrpdu;
struct packet_type;

/*
 * Opaque struct representing a port
 */
struct mrp_port
{
	struct packet_type packet_type;
	struct net_device * net_device;
	
	struct mrp * mrp;
	
	u8 application_address [6];
	u16 ether_type;
	
	int is_packet_reception_started;
};

struct mrp_port * mrp_port_create_and_init (const u8 application_address [6], u16 ether_type, const char * port_name);
void mrp_port_destroy (struct mrp_port ** mrp_port);

int mrp_port_set_mrp_application (struct mrp_port * mrp_port, struct mrp * mrp);

int mrp_port_start_packet_reception (struct mrp_port * mrp_port);
int mrp_port_stop_packet_reception (struct mrp_port * mrp_port);

int mrp_port_send_mrpdu (struct mrp_port * mrp_port, struct mrp_mrpdu * mrp_mrpdu);

#endif
